﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8" />
    <title>Xmpp: Client.cs Source File</title>
    <link href="/Content/Help.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/tabs.css" rel="stylesheet" type="text/css" />
    <link href="/Content/css/doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <div id="header">
        <img id="logo" alt="StateForge" src="/Content/Images/StateForgeLogo.png" />
        <div id="title">
            <h1>
                C# examples using state machines generated by StateBuilderDotNet
            </h1>
            <h3>
                Xmpp: Client.cs Source File
            </h3>
        </div>
        <div id="menucontainer">
            <ul id="menu">
                <li><a href="/">Home</a></li>
                <li><a href="/Home/Download">Downloads</a></li>
                <li><a href="/Help/state-machine-tools.aspx">Help</a></li>
                <li><a href="/Home/Faq">F.A.Q</a></li>
                <li><a href="/Home/About">Contact us</a></li>
            </ul>
        </div>
    </div>
<!-- Generated by Doxygen 1.7.4 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">Client.cs</div>  </div>
</div>
<div class="contents">
<a href="_client_8cs.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 ﻿
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="keyword">namespace </span>StateForge.Examples.XmppChat
<a name="l00004"></a>00004 {
<a name="l00005"></a>00005     <span class="keyword">using</span> System;
<a name="l00006"></a>00006     <span class="keyword">using</span> agsXMPP;
<a name="l00007"></a>00007     <span class="keyword">using</span> agsXMPP.protocol.client;
<a name="l00008"></a>00008     <span class="keyword">using</span> System.Diagnostics;
<a name="l00009"></a>00009     <span class="keyword">using</span> agsXMPP.protocol.iq.roster;
<a name="l00010"></a>00010     <span class="keyword">using</span> agsXMPP.Xml.Dom;
<a name="l00011"></a>00011     <span class="keyword">using</span> agsXMPP.sasl;
<a name="l00012"></a>00012 
<a name="l00013"></a>00013     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#aa3dec4381dcdb6359c8e40192991dd8f">LoginEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid);
<a name="l00014"></a>00014     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#aa3760b3c8128a3bdd38d725c41246fac">CloseEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid);
<a name="l00015"></a>00015     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a4f58397d7c25dcadc53b4083951d83a5">MessageEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, Message message);
<a name="l00016"></a>00016     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a093daaba61bc0d1fd8709003b3a93e7b">PresenceEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, Presence presence);
<a name="l00017"></a>00017     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a9eec11bcd5c2ac93cd9085660aca187a">SubscribeRequestEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, Jid from);
<a name="l00018"></a>00018     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a9d5fa7af49c168e253aa9144e7e6f4af">SubscribeConfirmEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, Jid from);
<a name="l00019"></a>00019     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#ada466e1de91ea6f948e6443a7ce668c1">ErrorEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, Exception exception);
<a name="l00020"></a>00020     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a834d9de6300f3b2080368250e708af96">RosterItemEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, RosterItem item);
<a name="l00021"></a>00021     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a5e6cb8f84daedc7940130d2a60ac0375">RosterEndEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid);
<a name="l00022"></a>00022 
<a name="l00023"></a>00023     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a31a94b951531f10c7a220ebadf7d8e9c">SaslStartEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, SaslEventArgs e);
<a name="l00024"></a>00024     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#ac4f2fd7eb91b00d045d36c50224544fc">AuthErrorEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, Element element);
<a name="l00025"></a>00025 
<a name="l00026"></a>00026     <span class="keyword">public</span> delegate <span class="keywordtype">void</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#aa1f3d1f316bc24f5b5af00fd94db5171">IqErrorEventHandler</a>(<span class="keywordtype">object</span> sender, Jid jid, Error error);
<a name="l00027"></a>00027 
<a name="l00028"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html">00028</a>     <span class="keyword">public</span> <span class="keyword">class </span><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html">Client</a>
<a name="l00029"></a>00029     {
<a name="l00030"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a7b54bbaf812db415ae05aae301033527">00030</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#aa3dec4381dcdb6359c8e40192991dd8f">LoginEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a7b54bbaf812db415ae05aae301033527">LoginHandler</a>;
<a name="l00031"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#ad17e946c7e43b3b9e2c098ca210e9b6b">00031</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#aa3760b3c8128a3bdd38d725c41246fac">CloseEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#ad17e946c7e43b3b9e2c098ca210e9b6b">CloseHandler</a>;
<a name="l00032"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#abc155349dd63d0673f7393b6d9690f96">00032</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a4f58397d7c25dcadc53b4083951d83a5">MessageEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#abc155349dd63d0673f7393b6d9690f96">MessageHandler</a>;
<a name="l00033"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a1751f8d91095aea87aa26c2362ded63e">00033</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a093daaba61bc0d1fd8709003b3a93e7b">PresenceEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a1751f8d91095aea87aa26c2362ded63e">PresenceHandler</a>;
<a name="l00034"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#acb9192e15b46c450db9c0e366a6d0e53">00034</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a9eec11bcd5c2ac93cd9085660aca187a">SubscribeRequestEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#acb9192e15b46c450db9c0e366a6d0e53">SubscribeRequestHandler</a>;
<a name="l00035"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a16bee587a46664d8623ec32aed45f1a1">00035</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a9d5fa7af49c168e253aa9144e7e6f4af">SubscribeConfirmEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a16bee587a46664d8623ec32aed45f1a1">SubscribeConfirmHandler</a>;
<a name="l00036"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a2b1a508421321afe94a555c5eeb101fa">00036</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#ada466e1de91ea6f948e6443a7ce668c1">ErrorEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a2b1a508421321afe94a555c5eeb101fa">ErrorHandler</a>;
<a name="l00037"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a8d1f5a8befa5cb71386d56a16181acf3">00037</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a834d9de6300f3b2080368250e708af96">RosterItemEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a8d1f5a8befa5cb71386d56a16181acf3">RosterItemHandler</a>;
<a name="l00038"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a66a7d36a34de9d485d0b2a682c8ca09c">00038</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a5e6cb8f84daedc7940130d2a60ac0375">RosterEndEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a66a7d36a34de9d485d0b2a682c8ca09c">RosterEndHandler</a>;
<a name="l00039"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a3766802a05eaabb89a0ee86d13cfccfd">00039</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#a31a94b951531f10c7a220ebadf7d8e9c">SaslStartEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a3766802a05eaabb89a0ee86d13cfccfd">SaslStartHandler</a>;
<a name="l00040"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a723ad06ab991e93bece21da91dddb545">00040</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#ac4f2fd7eb91b00d045d36c50224544fc">AuthErrorEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a723ad06ab991e93bece21da91dddb545">AuthErrorHandler</a>;
<a name="l00041"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#aa9b98a10489ececbc299fb9902a8c094">00041</a>         <span class="keyword">public</span> <span class="keyword">event</span> <a class="code" href="namespace_state_forge_1_1_examples_1_1_xmpp_chat.html#aa1f3d1f316bc24f5b5af00fd94db5171">IqErrorEventHandler</a> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#aa9b98a10489ececbc299fb9902a8c094">IqErrorHandler</a>;
<a name="l00042"></a>00042 
<a name="l00043"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#aff4a98c8899b9af78bdf5759ff0afd19">00043</a>         <span class="keyword">public</span> XmppClientConnection xmppClientConnection { <span class="keyword">get</span>; <span class="keyword">set</span>; }
<a name="l00044"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a61556dffca0a90756e11390c9acc43e1">00044</a>         <span class="keyword">public</span> Jid Jid { <span class="keyword">get</span>; <span class="keyword">set</span>; }
<a name="l00045"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a8a072a279cef2fb20344ebaeb743c448">00045</a>         <span class="keyword">private</span> <span class="keywordtype">string</span> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a8a072a279cef2fb20344ebaeb743c448">password</a>;
<a name="l00046"></a>00046 
<a name="l00047"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#aab18c99018f8245cd346986a55be38fb">00047</a>         <span class="keyword">private</span> <span class="keyword">static</span> readonly <span class="keywordtype">string</span> traceName = <span class="stringliteral">&quot;Client&quot;</span>;
<a name="l00048"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#aaf0b29baf8d3873110a0de48d169a621">00048</a>         <span class="keyword">private</span> <span class="keyword">static</span> TraceSource ts = <span class="keyword">new</span> TraceSource(traceName);
<a name="l00049"></a>00049 
<a name="l00050"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a625a6d042a8174939c2c75b4f3f8cbd0">00050</a>         <span class="keyword">public</span> <a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html">Client</a>(<span class="keywordtype">string</span> user, <span class="keywordtype">string</span> password, <span class="keywordtype">string</span> server)
<a name="l00051"></a>00051         {
<a name="l00052"></a>00052             this.Jid = <span class="keyword">new</span> Jid(user, server, null);
<a name="l00053"></a>00053             this.password = password;
<a name="l00054"></a>00054 
<a name="l00055"></a>00055             InitializeConnection();
<a name="l00056"></a>00056         }
<a name="l00057"></a>00057 
<a name="l00058"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a4c64280fa47841755ee22e4a14a973d3">00058</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> Open()
<a name="l00059"></a>00059         {
<a name="l00060"></a>00060             ts.TraceInformation(<span class="stringliteral">&quot;Start {0}&quot;</span>, this.Jid.ToString());
<a name="l00061"></a>00061             <span class="keywordflow">try</span>
<a name="l00062"></a>00062             {
<a name="l00063"></a>00063                 this.xmppClientConnection.Open();
<a name="l00064"></a>00064             }
<a name="l00065"></a>00065             <span class="keywordflow">catch</span> (System.Exception exception)
<a name="l00066"></a>00066             {
<a name="l00067"></a>00067                 ts.TraceEvent(TraceEventType.Error, 1, <span class="stringliteral">&quot;Start:  {0}&quot;</span>, exception.Message);
<a name="l00068"></a>00068             }
<a name="l00069"></a>00069         }
<a name="l00070"></a>00070 
<a name="l00071"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a048e2264c326834d46bcfd0383ba60bb">00071</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> Close()
<a name="l00072"></a>00072         {
<a name="l00073"></a>00073             ts.TraceInformation(<span class="stringliteral">&quot;Close {0}&quot;</span>, this.Jid.ToString());
<a name="l00074"></a>00074             this.xmppClientConnection.Close();
<a name="l00075"></a>00075         }
<a name="l00076"></a>00076 
<a name="l00077"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a23bf8b25f6b132bf83726b1dad898f56">00077</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> RegisterNewAccount()
<a name="l00078"></a>00078         {
<a name="l00079"></a>00079             this.xmppClientConnection.RegisterAccount = <span class="keyword">true</span>;
<a name="l00080"></a>00080             Open();
<a name="l00081"></a>00081         }
<a name="l00082"></a>00082 
<a name="l00083"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a05d8585020b6ceee7f99e5a55f881a15">00083</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SendMyPresence()
<a name="l00084"></a>00084         {
<a name="l00085"></a>00085             ts.TraceInformation(<span class="stringliteral">&quot;SendMyPresence {0}&quot;</span>, this.Jid.ToString());
<a name="l00086"></a>00086             this.xmppClientConnection.SendMyPresence();
<a name="l00087"></a>00087         }
<a name="l00088"></a>00088 
<a name="l00093"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#afffc6e084bf1965ced4dc2d9f5b2298e">00093</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SubscriptionRequest(Jid to)
<a name="l00094"></a>00094         {
<a name="l00095"></a>00095             ts.TraceInformation(<span class="stringliteral">&quot;SubscriptionRequest {0} to {1}&quot;</span>, this.Jid.ToString(), to.ToString());
<a name="l00096"></a>00096             this.xmppClientConnection.RosterManager.AddRosterItem(to);
<a name="l00097"></a>00097             this.xmppClientConnection.PresenceManager.Subscribe(to);
<a name="l00098"></a>00098         }
<a name="l00099"></a>00099 
<a name="l00104"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a1fa73404acb45b6173ba178eccb10a89">00104</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SubscriptionConfirm(Jid to)
<a name="l00105"></a>00105         {
<a name="l00106"></a>00106             ts.TraceInformation(<span class="stringliteral">&quot;SubscriptionConfirm {0} to {1}&quot;</span>, this.Jid.ToString(), to.ToString());
<a name="l00107"></a>00107             this.xmppClientConnection.RosterManager.AddRosterItem(to);
<a name="l00108"></a>00108             this.xmppClientConnection.PresenceManager.ApproveSubscriptionRequest(to);
<a name="l00109"></a>00109         }
<a name="l00110"></a>00110 
<a name="l00115"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#adf8725552a14ba9e07dba7407333d431">00115</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> UnSubscribe(Jid to)
<a name="l00116"></a>00116         {
<a name="l00117"></a>00117             ts.TraceInformation(<span class="stringliteral">&quot;UnSubscribe {0} to {1}&quot;</span>, this.Jid.ToString(), to.ToString());
<a name="l00118"></a>00118             this.xmppClientConnection.PresenceManager.Unsubscribe(to);
<a name="l00119"></a>00119         }
<a name="l00120"></a>00120 
<a name="l00125"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a77aa737761ca5e3a1d147cdf499e7871">00125</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SubscriptionRemove(Jid to)
<a name="l00126"></a>00126         {
<a name="l00127"></a>00127             ts.TraceInformation(<span class="stringliteral">&quot;SubscriptionRemove {0} to {1}&quot;</span>, this.Jid.ToString(), to.ToString());
<a name="l00128"></a>00128             this.xmppClientConnection.PresenceManager.RefuseSubscriptionRequest(to);
<a name="l00129"></a>00129         }
<a name="l00130"></a>00130 
<a name="l00135"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#afbb4cfc5a0f5881816761d63b752b512">00135</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> RosterAddItem(Jid to)
<a name="l00136"></a>00136         {
<a name="l00137"></a>00137             ts.TraceInformation(<span class="stringliteral">&quot;RosterAddItem {0} to {1}&quot;</span>, this.Jid.ToString(), to.ToString());
<a name="l00138"></a>00138             this.xmppClientConnection.RosterManager.AddRosterItem(to);
<a name="l00139"></a>00139         }
<a name="l00140"></a>00140 
<a name="l00145"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a0dc84f8367272f83857863d770abdafd">00145</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> RosterRemoveItem(Jid to)
<a name="l00146"></a>00146         {
<a name="l00147"></a>00147             ts.TraceInformation(<span class="stringliteral">&quot;RosterRemoveItem {0} to {1}&quot;</span>, this.Jid.ToString(), to.ToString());
<a name="l00148"></a>00148             this.xmppClientConnection.RosterManager.RemoveRosterItem(to);
<a name="l00149"></a>00149         }
<a name="l00150"></a>00150 
<a name="l00151"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a9959f06ebaa09e5d2c8fc6382eda1973">00151</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> RosterRequest()
<a name="l00152"></a>00152         {
<a name="l00153"></a>00153             ts.TraceInformation(<span class="stringliteral">&quot;RosterRequest {0}&quot;</span>, this.Jid.ToString());
<a name="l00154"></a>00154             this.xmppClientConnection.RequestRoster();
<a name="l00155"></a>00155         }
<a name="l00156"></a>00156 
<a name="l00157"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#ae7f2ac0a2a69f785c55516a5a0b2bca5">00157</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> AddRosterItem(Jid jid)
<a name="l00158"></a>00158         {
<a name="l00159"></a>00159             ts.TraceInformation(<span class="stringliteral">&quot;AddRosterItem {0} to {1}&quot;</span>, this.Jid.ToString(), jid);
<a name="l00160"></a>00160             this.xmppClientConnection.RosterManager.AddRosterItem(jid);
<a name="l00161"></a>00161         }
<a name="l00162"></a>00162 
<a name="l00163"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#ad363413f64bed9c80ffb42243f881492">00163</a>         <span class="keyword">public</span> <span class="keywordtype">void</span> SendChat(Jid to, <span class="keywordtype">string</span> messageText)
<a name="l00164"></a>00164         {
<a name="l00165"></a>00165             ts.TraceInformation(<span class="stringliteral">&quot;SendChat from {0} to {1}, msg: {2}&quot;</span>, this.Jid.ToString(), to.ToString(), messageText);
<a name="l00166"></a>00166             var message = <span class="keyword">new</span> Message(to, MessageType.chat, messageText);
<a name="l00167"></a>00167             this.xmppClientConnection.Send(message);
<a name="l00168"></a>00168         }
<a name="l00169"></a>00169 
<a name="l00170"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#ac8cce059622d7bcdf293ab7e530bb89d">00170</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> InitializeConnection()
<a name="l00171"></a>00171         {
<a name="l00172"></a>00172             this.xmppClientConnection = <span class="keyword">new</span> XmppClientConnection();
<a name="l00173"></a>00173             this.xmppClientConnection.AutoAgents = <span class="keyword">false</span>;
<a name="l00174"></a>00174             this.xmppClientConnection.AutoPresence = <span class="keyword">true</span>;
<a name="l00175"></a>00175             this.xmppClientConnection.AutoRoster = <span class="keyword">true</span>;
<a name="l00176"></a>00176             this.xmppClientConnection.AutoResolveConnectServer = <span class="keyword">false</span>;
<a name="l00177"></a>00177 
<a name="l00178"></a>00178             this.xmppClientConnection.Password = this.password;
<a name="l00179"></a>00179             this.xmppClientConnection.Username = Jid.User;
<a name="l00180"></a>00180             this.xmppClientConnection.Server = Jid.Server;
<a name="l00181"></a>00181             this.xmppClientConnection.ConnectServer = Jid.Server;
<a name="l00182"></a>00182             <span class="comment">//this.xmppClientConnection.UseSSL = false;</span>
<a name="l00183"></a>00183             <span class="comment">//this.xmppClientConnection.UseStartTLS = false;</span>
<a name="l00184"></a>00184             <span class="comment">//this.xmppClientConnection.UseCompression = false;</span>
<a name="l00185"></a>00185             this.xmppClientConnection.OnRosterStart += <span class="keyword">new</span> ObjectHandler(OnRosterStart);
<a name="l00186"></a>00186             this.xmppClientConnection.OnRosterItem += <span class="keyword">new</span> XmppClientConnection.RosterHandler(OnRosterItem);
<a name="l00187"></a>00187             this.xmppClientConnection.OnRosterEnd += <span class="keyword">new</span> ObjectHandler(OnRosterEnd);
<a name="l00188"></a>00188             this.xmppClientConnection.OnPresence += <span class="keyword">new</span> PresenceHandler(OnPresence);
<a name="l00189"></a>00189             this.xmppClientConnection.OnMessage += <span class="keyword">new</span> MessageHandler(OnMessage);
<a name="l00190"></a>00190             this.xmppClientConnection.OnLogin += <span class="keyword">new</span> ObjectHandler(OnLogin);
<a name="l00191"></a>00191             this.xmppClientConnection.OnClose += <span class="keyword">new</span> ObjectHandler(OnClose);
<a name="l00192"></a>00192             this.xmppClientConnection.OnError += <span class="keyword">new</span> ErrorHandler(OnError);
<a name="l00193"></a>00193             this.xmppClientConnection.OnAuthError += <span class="keyword">new</span> XmppElementHandler(OnAuthError);
<a name="l00194"></a>00194             <span class="comment">//this.xmppClientConnection.OnSaslStart += new SaslEventHandler(OnSaslStart);</span>
<a name="l00195"></a>00195             this.xmppClientConnection.OnIq += <span class="keyword">new</span> IqHandler(OnIq);
<a name="l00196"></a>00196             this.xmppClientConnection.OnReadXml += <span class="keyword">new</span> XmlHandler(OnReadXml);
<a name="l00197"></a>00197             this.xmppClientConnection.OnWriteXml += <span class="keyword">new</span> XmlHandler(OnWriteXml);
<a name="l00198"></a>00198             this.xmppClientConnection.ClientSocket.OnValidateCertificate += <span class="keyword">new</span> System.Net.Security.RemoteCertificateValidationCallback(OnValidateCertificate);
<a name="l00199"></a>00199             this.xmppClientConnection.OnSocketError += <span class="keyword">new</span> ErrorHandler(OnSocketError);
<a name="l00200"></a>00200             this.xmppClientConnection.OnStreamError += <span class="keyword">new</span> XmppElementHandler(OnStreamError);
<a name="l00201"></a>00201         }
<a name="l00202"></a>00202 
<a name="l00203"></a>00203 
<a name="l00204"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a5c5a62c35f52db9792f835bef2d0ac64">00204</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnReadXml(<span class="keywordtype">object</span> sender, <span class="keywordtype">string</span> xml)
<a name="l00205"></a>00205         {
<a name="l00206"></a>00206             ts.TraceEvent(TraceEventType.Verbose, 1, <span class="stringliteral">&quot;OnReadXml {0}&quot;</span>, <span class="keyword">this</span>.Jid.ToString());
<a name="l00207"></a>00207             ts.TraceEvent(TraceEventType.Verbose, 1, <span class="stringliteral">&quot;{0}&quot;</span>, xml);
<a name="l00208"></a>00208         }
<a name="l00209"></a>00209 
<a name="l00210"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a83349c8028e772754f168f772b6e0965">00210</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnWriteXml(<span class="keywordtype">object</span> sender, <span class="keywordtype">string</span> xml)
<a name="l00211"></a>00211         {
<a name="l00212"></a>00212             ts.TraceEvent(TraceEventType.Verbose, 1, <span class="stringliteral">&quot;OnWriteXml {0}&quot;</span>, <span class="keyword">this</span>.Jid.ToString());
<a name="l00213"></a>00213             ts.TraceEvent(TraceEventType.Verbose, 1, <span class="stringliteral">&quot;{0}&quot;</span>, xml);
<a name="l00214"></a>00214         }
<a name="l00215"></a>00215 
<a name="l00216"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a7004a29d1ccde56ee50d38c2ccd6110c">00216</a>         <span class="keywordtype">void</span> OnStreamError(<span class="keywordtype">object</span> sender, Element e)
<a name="l00217"></a>00217         {
<a name="l00218"></a>00218             ts.TraceEvent(TraceEventType.Error, 1, <span class="stringliteral">&quot;OnStreamError {0}, error: {1}&quot;</span>,
<a name="l00219"></a>00219                 <span class="keyword">this</span>.Jid.ToString(),
<a name="l00220"></a>00220                 e.ToString());
<a name="l00221"></a>00221         }
<a name="l00222"></a>00222 
<a name="l00223"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#affa2f396a94fc45233e78360d65a989c">00223</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnSocketError(<span class="keywordtype">object</span> sender, Exception exception)
<a name="l00224"></a>00224         {
<a name="l00225"></a>00225             ts.TraceEvent(TraceEventType.Error, 1, <span class="stringliteral">&quot;OnSocketError {0}, exception: {1}&quot;</span>,
<a name="l00226"></a>00226                 <span class="keyword">this</span>.Jid.ToString(),
<a name="l00227"></a>00227                 exception.Message);
<a name="l00228"></a>00228         }
<a name="l00229"></a>00229 
<a name="l00230"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a0054c4496a87ba3842442829e8ca5bee">00230</a>         <span class="keyword">private</span> <span class="keywordtype">bool</span> OnValidateCertificate(<span class="keywordtype">object</span> sender, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, System.Net.Security.SslPolicyErrors sslPolicyErrors)
<a name="l00231"></a>00231         {
<a name="l00232"></a>00232             ts.TraceInformation(<span class="stringliteral">&quot;OnValidateCertificate {0}&quot;</span>, this.Jid.ToString(), certificate.ToString());
<a name="l00233"></a>00233             <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00234"></a>00234         }
<a name="l00235"></a>00235 
<a name="l00236"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#ae85f9266134ff2f18fa0d8fcf74e8039">00236</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnIq(<span class="keywordtype">object</span> sender, agsXMPP.protocol.client.IQ iq)
<a name="l00237"></a>00237         {
<a name="l00238"></a>00238             <span class="keywordflow">if</span> (iq != null)
<a name="l00239"></a>00239             {
<a name="l00240"></a>00240                 <span class="keywordflow">if</span> (iq.Error != null)
<a name="l00241"></a>00241                 {
<a name="l00242"></a>00242                     OnIqError(iq);
<a name="l00243"></a>00243                 }
<a name="l00244"></a>00244 
<a name="l00245"></a>00245                 <span class="comment">// No Iq with Query</span>
<a name="l00246"></a>00246                 <span class="keywordflow">if</span> (iq.HasTag(typeof(agsXMPP.protocol.extensions.si.SI)))
<a name="l00247"></a>00247                 {
<a name="l00248"></a>00248                     <span class="keywordflow">if</span> (iq.Type == IqType.set)
<a name="l00249"></a>00249                     {
<a name="l00250"></a>00250                         agsXMPP.protocol.extensions.si.SI si = iq.SelectSingleElement(typeof(agsXMPP.protocol.extensions.si.SI)) as agsXMPP.protocol.extensions.si.SI;
<a name="l00251"></a>00251 
<a name="l00252"></a>00252                         agsXMPP.protocol.extensions.filetransfer.File file = si.File;
<a name="l00253"></a>00253                         <span class="keywordflow">if</span> (file != null)
<a name="l00254"></a>00254                         {
<a name="l00255"></a>00255                             <span class="comment">// somebody wants to send a file to us</span>
<a name="l00256"></a>00256                             Console.WriteLine(file.Size.ToString());
<a name="l00257"></a>00257                             Console.WriteLine(file.Name);
<a name="l00258"></a>00258                         }
<a name="l00259"></a>00259                     }
<a name="l00260"></a>00260                 }
<a name="l00261"></a>00261                 <span class="keywordflow">else</span>
<a name="l00262"></a>00262                 {
<a name="l00263"></a>00263                     Element query = iq.Query;
<a name="l00264"></a>00264 
<a name="l00265"></a>00265                     <span class="keywordflow">if</span> (query != null)
<a name="l00266"></a>00266                     {
<a name="l00267"></a>00267                         <span class="keywordflow">if</span> (query.GetType() == typeof(agsXMPP.protocol.iq.version.Version))
<a name="l00268"></a>00268                         {
<a name="l00269"></a>00269                             OnIqVersion(iq, query);
<a name="l00270"></a>00270                         }
<a name="l00271"></a>00271                         <span class="keywordflow">else</span> <span class="keywordflow">if</span> (query.GetType() == typeof(agsXMPP.protocol.iq.register.Register))
<a name="l00272"></a>00272                         {
<a name="l00273"></a>00273                             OnIqRegister(iq, query);
<a name="l00274"></a>00274                         }
<a name="l00275"></a>00275                     }
<a name="l00276"></a>00276                 }
<a name="l00277"></a>00277             }
<a name="l00278"></a>00278         }
<a name="l00279"></a>00279 
<a name="l00280"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a5165c5678e533b6951ae6e8fcfcb02dd">00280</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnIqError(agsXMPP.protocol.client.IQ iq)
<a name="l00281"></a>00281         {
<a name="l00282"></a>00282             ts.TraceInformation(<span class="stringliteral">&quot;OnIqError {0} error type {1}, code: {2}&quot;</span>,
<a name="l00283"></a>00283                                 this.Jid.ToString(), iq.Error.Type, iq.Error.Code);
<a name="l00284"></a>00284             <span class="keywordflow">if</span> (IqErrorHandler != null)
<a name="l00285"></a>00285             {
<a name="l00286"></a>00286                 IqErrorHandler(<span class="keyword">this</span>, this.Jid, iq.Error);
<a name="l00287"></a>00287             }
<a name="l00288"></a>00288         }
<a name="l00289"></a>00289 
<a name="l00290"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#acdbde560bb4b4fd434decae01800f0fe">00290</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnIqRegister(agsXMPP.protocol.client.IQ iq, Element query)
<a name="l00291"></a>00291         {
<a name="l00292"></a>00292             ts.TraceInformation(<span class="stringliteral">&quot;OnIqRegister {0} Query: {1}&quot;</span>, this.Jid.ToString(), query.ToString());
<a name="l00293"></a>00293 
<a name="l00294"></a>00294         }
<a name="l00295"></a>00295 
<a name="l00296"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a8c491f3a895b62886e475d1ee5b62ae6">00296</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnIqVersion(agsXMPP.protocol.client.IQ iq, Element query)
<a name="l00297"></a>00297         {
<a name="l00298"></a>00298             ts.TraceInformation(<span class="stringliteral">&quot;OnIqVersion {0}&quot;</span>, this.Jid.ToString());
<a name="l00299"></a>00299             <span class="comment">// its a version IQ VersionIQ</span>
<a name="l00300"></a>00300             agsXMPP.protocol.iq.version.Version version = query as agsXMPP.protocol.iq.version.Version;
<a name="l00301"></a>00301             <span class="keywordflow">if</span> (iq.Type == IqType.get)
<a name="l00302"></a>00302             {
<a name="l00303"></a>00303                 iq.SwitchDirection();
<a name="l00304"></a>00304                 iq.Type = IqType.result;
<a name="l00305"></a>00305 
<a name="l00306"></a>00306                 version.Name = <span class="stringliteral">&quot;StateForgeClient&quot;</span>;
<a name="l00307"></a>00307                 version.Ver = <span class="stringliteral">&quot;0.1&quot;</span>;
<a name="l00308"></a>00308                 version.Os = Environment.OSVersion.ToString();
<a name="l00309"></a>00309 
<a name="l00310"></a>00310                 this.xmppClientConnection.Send(iq);
<a name="l00311"></a>00311             }
<a name="l00312"></a>00312         }
<a name="l00313"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a89472541f36df7204aefce467db6696e">00313</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnRosterStart(<span class="keywordtype">object</span> sender)
<a name="l00314"></a>00314         {
<a name="l00315"></a>00315             ts.TraceInformation(<span class="stringliteral">&quot;OnRosterStart {0}&quot;</span>, this.Jid.ToString());
<a name="l00316"></a>00316         }
<a name="l00317"></a>00317 
<a name="l00318"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#aaa067a306cbdc91ac7dd65cdd1ce2d04">00318</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnRosterItem(<span class="keywordtype">object</span> sender, agsXMPP.protocol.iq.roster.RosterItem item)
<a name="l00319"></a>00319         {
<a name="l00320"></a>00320 
<a name="l00321"></a>00321             ts.TraceInformation(<span class="stringliteral">&quot;OnRosterItem {0} ask {1}, from {2}&quot;</span>, this.Jid.ToString(), item.Ask, item.Jid.ToString());
<a name="l00322"></a>00322 
<a name="l00323"></a>00323             <span class="keywordflow">if</span> (item.Ask == AskType.subscribe)
<a name="l00324"></a>00324             {
<a name="l00325"></a>00325                 <span class="comment">//ts.TraceInformation(&quot;OnRosterItem {0} ask=subscribe&quot;, this.Jid.ToString(), item.ToString());</span>
<a name="l00326"></a>00326                 <span class="keywordflow">if</span> (SubscribeConfirmHandler != null)
<a name="l00327"></a>00327                 {
<a name="l00328"></a>00328                     SubscribeConfirmHandler(<span class="keyword">this</span>, this.Jid, item.Jid);
<a name="l00329"></a>00329                 }
<a name="l00330"></a>00330             }
<a name="l00331"></a>00331 
<a name="l00332"></a>00332             <span class="keywordflow">if</span> (RosterItemHandler != null)
<a name="l00333"></a>00333             {
<a name="l00334"></a>00334                 RosterItemHandler(<span class="keyword">this</span>, this.Jid, item);
<a name="l00335"></a>00335             }
<a name="l00336"></a>00336         }
<a name="l00337"></a>00337 
<a name="l00338"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a03ef7f220d3b42dc9cc1dcfd6b184345">00338</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnRosterEnd(<span class="keywordtype">object</span> sender)
<a name="l00339"></a>00339         {
<a name="l00340"></a>00340             ts.TraceInformation(<span class="stringliteral">&quot;OnRosterEnd {0}&quot;</span>, this.Jid.ToString());
<a name="l00341"></a>00341             <span class="keywordflow">if</span> (RosterEndHandler != null)
<a name="l00342"></a>00342             {
<a name="l00343"></a>00343                 RosterEndHandler(<span class="keyword">this</span>, this.Jid);
<a name="l00344"></a>00344             }
<a name="l00345"></a>00345         }
<a name="l00346"></a>00346 
<a name="l00347"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a0f94f8b4957b6d7ef7630b2b68b332ec">00347</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnPresence(<span class="keywordtype">object</span> sender, Presence presence)
<a name="l00348"></a>00348         {
<a name="l00349"></a>00349             ts.TraceInformation(<span class="stringliteral">&quot;OnPresence {0}, type: {1}, error: {2}&quot;</span>,
<a name="l00350"></a>00350                 this.Jid.ToString(), presence.Type, presence.Error);
<a name="l00351"></a>00351 
<a name="l00352"></a>00352             <span class="keywordflow">if</span> (presence.Type == PresenceType.subscribe)
<a name="l00353"></a>00353             {
<a name="l00354"></a>00354                 <span class="keywordflow">if</span> (SubscribeRequestHandler != null)
<a name="l00355"></a>00355                 {
<a name="l00356"></a>00356                     SubscribeRequestHandler(<span class="keyword">this</span>, this.Jid, presence.From);
<a name="l00357"></a>00357                 }
<a name="l00358"></a>00358             }
<a name="l00359"></a>00359 
<a name="l00360"></a>00360             <span class="keywordflow">else</span>
<a name="l00361"></a>00361             {
<a name="l00362"></a>00362                 <span class="keywordflow">if</span> (PresenceHandler != null)
<a name="l00363"></a>00363                 {
<a name="l00364"></a>00364                     PresenceHandler(<span class="keyword">this</span>, this.Jid, presence);
<a name="l00365"></a>00365                 }
<a name="l00366"></a>00366             }
<a name="l00367"></a>00367         }
<a name="l00368"></a>00368 
<a name="l00369"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a820513fb7ba41ba85322de5a5c368da8">00369</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnMessage(<span class="keywordtype">object</span> sender, Message message)
<a name="l00370"></a>00370         {
<a name="l00371"></a>00371             <span class="keywordflow">if</span> (message.Error != null)
<a name="l00372"></a>00372             {
<a name="l00373"></a>00373                 ts.TraceInformation(<span class="stringliteral">&quot;OnMessage {0} from {1} to {2}, error: {3}, body: {4}&quot;</span>,
<a name="l00374"></a>00374                                     this.Jid.ToString(), message.From, message.To, message.Error.Code, message.Body);
<a name="l00375"></a>00375             }
<a name="l00376"></a>00376             <span class="keywordflow">else</span>
<a name="l00377"></a>00377             {
<a name="l00378"></a>00378                 ts.TraceInformation(<span class="stringliteral">&quot;OnMessage {0} from {1} to {2}, body: {3}&quot;</span>,
<a name="l00379"></a>00379                                     this.Jid.ToString(), message.From, message.To, message.Body);
<a name="l00380"></a>00380             }
<a name="l00381"></a>00381 
<a name="l00382"></a>00382             <span class="keywordflow">if</span> (MessageHandler != null)
<a name="l00383"></a>00383             {
<a name="l00384"></a>00384                 MessageHandler(<span class="keyword">this</span>, this.Jid, message);
<a name="l00385"></a>00385             }
<a name="l00386"></a>00386         }
<a name="l00387"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a8c8d39bcf4f9954df171d2e203d4522b">00387</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnError(<span class="keywordtype">object</span> sender, System.Exception exception)
<a name="l00388"></a>00388         {
<a name="l00389"></a>00389             ts.TraceInformation(<span class="stringliteral">&quot;OnError {0}, exception:  {1}&quot;</span>,
<a name="l00390"></a>00390                 this.Jid.ToString(), exception.Message);
<a name="l00391"></a>00391             ts.TraceInformation(<span class="stringliteral">&quot;{0}&quot;</span>, exception.StackTrace);
<a name="l00392"></a>00392 
<a name="l00393"></a>00393             <span class="keywordflow">if</span> (ErrorHandler != null)
<a name="l00394"></a>00394             {
<a name="l00395"></a>00395                 ErrorHandler(<span class="keyword">this</span>, this.Jid, exception);
<a name="l00396"></a>00396             }
<a name="l00397"></a>00397         }
<a name="l00398"></a>00398 
<a name="l00399"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a6b418d03edd6ba4439514bd307bb32be">00399</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnLogin(<span class="keywordtype">object</span> sender)
<a name="l00400"></a>00400         {
<a name="l00401"></a>00401             ts.TraceInformation(<span class="stringliteral">&quot;OnLogin {0}&quot;</span>, this.Jid.ToString());
<a name="l00402"></a>00402             <span class="keywordflow">if</span> (LoginHandler != null)
<a name="l00403"></a>00403             {
<a name="l00404"></a>00404                 LoginHandler(<span class="keyword">this</span>, this.Jid);
<a name="l00405"></a>00405             }
<a name="l00406"></a>00406         }
<a name="l00407"></a>00407 
<a name="l00408"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#ad5eaa0d03a8c3efa1a5565f6bccc0afc">00408</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnClose(<span class="keywordtype">object</span> sender)
<a name="l00409"></a>00409         {
<a name="l00410"></a>00410             ts.TraceInformation(<span class="stringliteral">&quot;OnClose {0}&quot;</span>, this.Jid.ToString());
<a name="l00411"></a>00411             <span class="keywordflow">if</span> (CloseHandler != null)
<a name="l00412"></a>00412             {
<a name="l00413"></a>00413                 CloseHandler(<span class="keyword">this</span>, this.Jid);
<a name="l00414"></a>00414             }
<a name="l00415"></a>00415         }
<a name="l00416"></a>00416 
<a name="l00417"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#aae6ccdb4b9c9fa3eb78a67066466766b">00417</a>         <span class="keywordtype">void</span> OnSaslStart(<span class="keywordtype">object</span> sender, SaslEventArgs e)
<a name="l00418"></a>00418         {
<a name="l00419"></a>00419             ts.TraceInformation(<span class="stringliteral">&quot;OnSaslStart {0}&quot;</span>, this.Jid.ToString());
<a name="l00420"></a>00420             e.Auto = <span class="keyword">false</span>;
<a name="l00421"></a>00421             <span class="comment">//e.SaslMechanism = Matrix.Xmpp.Sasl.SaslMechanism.NONE;</span>
<a name="l00422"></a>00422             <span class="keywordflow">if</span> (SaslStartHandler != null)
<a name="l00423"></a>00423             {
<a name="l00424"></a>00424                 SaslStartHandler(<span class="keyword">this</span>, this.Jid, e);
<a name="l00425"></a>00425             }
<a name="l00426"></a>00426         }
<a name="l00427"></a>00427 
<a name="l00428"></a><a class="code" href="class_state_forge_1_1_examples_1_1_xmpp_chat_1_1_client.html#a5c767afe535a6faf8e64a8bcb7f91d0a">00428</a>         <span class="keyword">private</span> <span class="keywordtype">void</span> OnAuthError(<span class="keywordtype">object</span> sender, Element element)
<a name="l00429"></a>00429         {
<a name="l00430"></a>00430             ts.TraceInformation(<span class="stringliteral">&quot;OnAuthError {0}, error {1}&quot;</span>, this.Jid.ToString(), element.ToString());
<a name="l00431"></a>00431             <span class="keywordflow">if</span> (AuthErrorHandler != null)
<a name="l00432"></a>00432             {
<a name="l00433"></a>00433                 AuthErrorHandler(<span class="keyword">this</span>, this.Jid, element);
<a name="l00434"></a>00434             }
<a name="l00435"></a>00435         }
<a name="l00436"></a>00436     }
<a name="l00437"></a>00437 }
</pre></div></div>
</div>
﻿<div id="footer">
    <hr />
    <p>
        Copyright &copy; 2011 StateForge.</p>
    <hr />
</div>
</body> </html> 
